package com.qiangesoft.blog.controller.web;

import com.qiangesoft.blog.common.result.ResponseResult;
import com.qiangesoft.blog.core.entity.BlogLeaveMessage;
import com.qiangesoft.blog.core.service.IBlogLeaveMessageService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 评论留言 前端控制器
 * </p>
 *
 * @author qiange
 * @date 2023-06-01
 */
@RestController
@RequestMapping("/api/message")
@Api(tags = "留言管理")
@RequiredArgsConstructor
public class ApiBlogLeaveMessageController {

    private final IBlogLeaveMessageService messageService;

    @RequestMapping(value = "/webMessage", method = RequestMethod.GET)
    @ApiOperation(value = "留言列表", httpMethod = "GET", response = ResponseResult.class, notes = "留言列表")
    public ResponseResult webMessage() {
        return messageService.webMessage();
    }


    @PostMapping
    @ApiOperation(value = "添加留言")
    public ResponseResult addMessage(@RequestBody BlogLeaveMessage message) {
        return messageService.webAddMessage(message);
    }

}

